/* Setup Rounting For All Pages */
App.config(['$stateProvider', '$urlRouterProvider', function($stateProvider, $urlRouterProvider) {

    $stateProvider
	    .state('auth.bpmDesign', {
	        url: "/bpm/design/:modelId",
	        templateUrl: "views/bpm/design.html",
	        controller: function($rootScope, $scope, $stateParams) {
	            $scope.modelPath = 'views/bpm/modeler.html?modelId=' + $stateParams.modelId;
	        }
	    })
	
	    // 发起流程
	    .state('auth.processStart', {
	        url: "/bpm/process/start",
	        templateUrl: "views/bpm/start.html",
	        params: {'process': null,'businessId': null, '_service': null},
	        controller: 'startController',
	        resolve: {
	            deps: ['$ocLazyLoad', function($ocLazyLoad) {
	                return $ocLazyLoad.load([{
	                    name: 'App',
	                    insertBefore: '#ng_load_plugins_before',
	                    files: [
	                        'js/controllers/bpm/startController.js'
	                    ]
	                }]);
	            }]
	        }
	    })
	    
	    // 任务办理
	    .state('auth.taskComplete', {
	        url: "/bpm/task/:taskId",
	        templateUrl: "views/bpm/task.html",
	        params: {'task': null},
	        controller: 'taskController',
	        resolve: {
	            deps: ['$ocLazyLoad', function($ocLazyLoad) {
	                return $ocLazyLoad.load([{
	                    name: 'App',
	                    insertBefore: '#ng_load_plugins_before',
	                    files: [
	                        'js/controllers/bpm/taskController.js'
	                    ]
	                }]);
	            }]
	        }
	    })

        //流程跟踪
        .state('auth.processView', {
            url: "/bpm/process/view",
            templateUrl: "views/bpm/track.html",
            params: {'processInstanceId': null, 'task': null},
            controller: 'trackController',
            resolve: {
                deps: ['$ocLazyLoad', function($ocLazyLoad) {
                    return $ocLazyLoad.load([{
                        name: 'App',
                        insertBefore: '#ng_load_plugins_before',
                        files: [
                            'js/controllers/bpm/trackController.js'
                        ]
                    }]);
                }]
            }
        })
        
}]);
